package C;

import java.util.Arrays;
import java.util.Scanner;

public class C58 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = Integer.parseInt(sc.nextLine());
        int[] nums = Arrays.stream(sc.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
        int n = Integer.parseInt(sc.nextLine());

        System.out.println(getResult(nums,n));
    }

    public static int getResult(int[] nums,int n) {
        int count=0;
        int sum = 0;
        for (int i = 0; i < nums.length; i++) {
            for (int j = nums.length - 1; j >i; j--) {
                sum = nums[i]+nums[j];
                if (sum==n) {
                    count++;
                } else if (sum<n) {
                    break;
                }
            }
        }
        return count;
    }
}
